﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;

using CloudSoft.Workflows;

namespace ERPStore.NewsLetters.Workflows.Activities
{
	public sealed class PrepareCampaign : CodeActivity
	{
		public InArgument<Models.Campaign> Campaign { get; set; }
		public InArgument<DateTime> StartDate { get; set; }

		protected override void Execute(CodeActivityContext context)
		{
			var campaign = context.GetValue(this.Campaign);
			var startDate = context.GetValue(this.StartDate);
			var newsLetterService = context.GetService<Services.NewsLettersService>();

			campaign.State = Models.SendState.Pending;
			newsLetterService.SaveCampaign(campaign);
		}
	}
}
